{% extends 'home.html' %}


{% block content %}
    <h1 class="text-center">书籍添加</h1>
    <form action="{% url 'book_add' %}" method="post">
        {% csrf_token %}
        <p>
            书名:<input type="text" class="form-control" name="title">
        </p>
        <p>
            价格:<input type="text" class="form-control" name="price">
        </p>
        <p>
            出版日期:<input type="date" class="form-control" name="publish_date">
        </p>
        <p>
            出版社:
            <select name="publish" id="" class="form-control">
                {% for publish_obj in publish_queryset %}
                    <option value="{{ publish_obj.pk }}">{{ publish_obj.name }}</option>
                {% endfor %}
            </select>
        </p>
        <p>
            作者:
            <select name="authors" id="" class="form-control" multiple>
                {% for author_obj in author_queryset %}
                    <option value="{{ author_obj.pk }}">{{ author_obj.name }}</option>
                {% endfor %}

            </select>
        </p>
        <input type="submit" class="btn btn-primary btn-block" value="新增">
    </form>
{% endblock %}